package com.examp.flowable.listen;

import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.impl.el.FixedValue;
import org.flowable.task.service.delegate.DelegateTask;
import org.flowable.task.service.delegate.TaskListener;

/**
 * 任务监听器
 *
 * @author Liu
 * @date 2025-09-10  23:03
 */
@Setter
@Slf4j
public class TaskSimpleListener implements TaskListener {

    // 流程节点中监听器里设置的变量field1
    private FixedValue field1;
    // 流程节点中监听器里设置的变量field2
    private FixedValue field2;

    @Override
    public void notify(DelegateTask task) {
        log.info("任务监听器触发--------------开始");
        log.info("任务名称: {}", task.getName());
        log.info("任务触发名称: {}", task.getEventName());
        log.info("任务ID: {}", task.getId());
        log.info("任务描述: {}", task.getDescription());
        log.info("任务指派人: {}", task.getAssignee());
        log.info("任务所属流程定义id: {}", task.getProcessDefinitionId());
        log.info("流程实例id: {}", task.getProcessInstanceId());
        log.info("任务监听器触发--------------结束");
    }
}
